-
-
Notifications
You must be signed in to change notification settings - Fork 530
fix(form-core): call onSubmitInvalid
even when canSubmit
is false
#1697
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
View your CI Pipeline Execution ↗ for commit cc883c4
☁️ Nx Cloud last updated this comment at |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1697 +/- ##
==========================================
+ Coverage 90.35% 90.48% +0.12%
==========================================
Files 38 38
Lines 1752 1786 +34
Branches 444 451 +7
==========================================
+ Hits 1583 1616 +33
- Misses 149 150 +1
Partials 20 20 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
formApi: this, | ||
meta: submitMetaArg, | ||
}) | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
While this ensures onSubmitInvalid
gets called, it happens before the submit validation. This means the formApi
will have a stale error state when the callback is triggered.
@kusiewicz It happens before the submit validation, but only in cases where If a user wanted to rerun validators even if |
Ok i got it. I just thought that there:
we should expect most recent errors, didn't know about |
well, they are the most recent errors. The most recent errors are preventing a submit altogether, so this PR asserts that attempting one should still trigger |
Hello @Pascalmh! I encountered the same issue mentioned by @kusiewicz. Calling Would you consider restructuring the logic to first perform the validation, check If it's okay with you, would it be possible for me to work on this and submit a PR? |
@jiji-hoon96 sure, if you want you can PR against my fork and I'll merge your changes in so they appear in this PR here - or you can create a new PR, whatever you prefere 👍 |
@jiji-hoon96 Are you sure it's stale? Even with |
Yes. I have confirmed its validity through testing. I may have made a mistake, so I would appreciate it if you could take a look at #1711 PR. |
I have submitted a pull request with some modifications to @Pascalmh`s work. |
…rm states Signed-off-by: Pascal Küsgen <[email protected]>
🦋 Changeset detectedLatest commit: cc883c4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 9 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
onSubmitInvalid
not called when canSubmit
falseonSubmitInvalid
even when canSubmit
is false
This has been long overdue. Thanks for the fix! |
onSubmitInvalid
callback inFormApi
is called when a submission attempt is made whilecanSubmit
is falseFixes #1696